package ooday03;

/**
 * @author Pxl
 */
public class Test2 {
    public static void main(String[] args) {
        Dog[]dogs=new Dog[3];
        dogs[0]=new Dog("小黑",2,"黑");
        dogs[1]=new Dog("小白",1,"白");
        dogs[2]=new Dog("小灰",3,"灰");
        //输出第一只狗的名字
        System.out.println(dogs[0].name);
        //修改第二只构的年龄
        dogs[1].age=4;
        //第三只狗在游泳
        dogs[2].swim();
        //把小黑染成白色
        dogs[0].color="白色";
        System.out.println("小黑被染成了"+dogs[0].color);
        for(int i=0;i<dogs.length;++i){
            System.out.println(dogs[i].name);
            dogs[i].eat();

        }
    }
}
